#include <riscv/sbi.h>
#include <linux/compiler.h>

#include <riscv/smp.h>

unsigned long boot_cpu_hartid;

__weak void machine_init(void)
{
}

__weak uintptr_t early_pgtable_setup(uintptr_t dtb_pa, uintptr_t start_pa)
{
    return 0;
}

__weak void paging_init(void)
{
}

void setup_arch(char **cmdline_p)
{
    sbi_init();

    machine_init();

    paging_init();
#ifdef CONFIG_SMP
    setup_smp();
#endif
}

uintptr_t early_setup(int hartid, uintptr_t dtb_pa, uintptr_t start_pa)
{
    uintptr_t satp;

    satp = early_pgtable_setup(dtb_pa, start_pa);

    return satp;
}
